﻿using MrPP.iot;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace MrPP.SerriedCabinet
{
    public class ActionFactory : MonoBehaviour, IEventFactory
    {

        public Action<Data> onRecevie
        {
            get;
            set;
        }

        public class Data
        {
            public byte result;
        }
        [SerializeField]
        private string _type;
        public string type => _type;

        public void post(string data)
        {
            Data evt = JsonUtility.FromJson<Data>(data);
            //Debug.LogError(JsonUtility.ToJson(evt));

            onRecevie?.Invoke(evt);
        }
    }
}